/* 
 *	Copyright (C) 2009-2010 miaohua
 *	http://code.google.com/p/lrcshower/
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */

#pragma once
#include "TypeDef.h"




// Lrc show filter properties setting class
class CLrcOnLineSearchProperties : public CBasePropertyPage
{
public:

    static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);
    DECLARE_IUNKNOWN;

private:

    BOOL OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
    static BOOL CALLBACK LrcSelDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

    HRESULT OnConnect(IUnknown *pUnknown);
    HRESULT OnDisconnect();
    HRESULT OnActivate();
    HRESULT OnApplyChanges();

    // Set parameters functions
    void SetDirty();
    void SetFolder(HWND Hwnd);
    void SetMediaFile(HWND Hwnd);

    // Initialization functions
    void InitializeCtrls(HWND Hwnd);
  	void InitializeComboBox(HWND Hwnd, HWND & Handler, UINT CtlID, TCHAR ** Items, int Size, int OptIdx=0);
    static void FillLrcFileList(HWND LrcFileList, bool InitDlg=true);
    // Do search lrc(baidu, sogou ,etc.)
    void SearchLrcOnline(HWND Hwnd);
    // Searc lrc helper function
    bool DoSearchLrc(HWND Hwnd, tstring & ErrMsg);
    
    CLrcOnLineSearchProperties(LPUNKNOWN lpunk, HRESULT *phr);

    ILrcShowFilter*  m_ILrcShowFilter;    // Lrc Show Filter property interface
    HWND m_AutoSearchChkBox;              // Auto serach check box handler
    HWND m_SelRandChkBox;                 // Select randomly check box handler
    HWND m_PromptMultiChkBox;             // Prompt to user(if more lrc files) check box handler
    HWND m_AutoParseChkBox;               // Auto parse media file to get song and singer information check box handler
    HWND m_SearchEngineSel;               // Search engine select combox handler
    
};

